package org.boge.sharpdoc.config;

import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.io.File;

@ConfigurationProperties(prefix = "customize")
@Component
public class Settings {
    @Setter
    private String storeFileBasePath;

    public File getIconsDir() {
        File iconsDir = new File(storeFileBasePath, "icons");
        if(!iconsDir.exists())
            iconsDir.mkdirs();
        return iconsDir;
    }

    public File getDocsDir() {
        File docsDir = new File(storeFileBasePath, "docs");
        if(!docsDir.exists())
            docsDir.mkdirs();
        return docsDir;
    }

    public File getDocumentDealDir() {
        return new File(storeFileBasePath, "documentDeal");
    }

    public File getAvatarsDir() {
        File avatarsDir = new File(storeFileBasePath, "avatars");
        if(!avatarsDir.exists())
            avatarsDir.mkdirs();
        return avatarsDir;
    }

    public File getBannersDir(){
        File bannerDir=new File(storeFileBasePath,"banners");
        if(!bannerDir.exists())
            bannerDir.mkdirs();
        return bannerDir;
    }
}
